/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package specifications;

import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.nodes.Tag;

/**
 *
 * @author Jason
 */
public class Expectations extends Parameter implements YamlObject<Expectations> {
    public static final Tag TAG = new Tag("!Expectations");
    private String compensation;
    private Communication communication;
   
    public Expectations(){}
    public Expectations(String comp, Communication comm){
        setPriority(10);
        this.compensation = comp;
        this.communication = comm;
    }
    @Override
    public ArrayList<Directive> getDirectives() {
        return getCommunication().getInstructions();
    }

    @Override
    public void dump(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileWriter writer = new FileWriter(filename);
        writer.write(yaml.dumpAs(this, TAG, DumperOptions.FlowStyle.BLOCK));
        writer.close();
    }

    @Override
    public Expectations load(String filename) throws IOException {
        Yaml yaml = new Yaml(CONSTRUCTOR, REPRESENTER);
        FileReader reader = new FileReader(filename);
        Expectations param = yaml.loadAs(reader, Expectations.class);
        reader.close();
        return param;
    }


    /**
     * @return the compensation
     */
    public String getCompensation() {
        return compensation;
    }

    /**
     * @param compensation the compensation to set
     */
    public void setCompensation(String compensation) {
        this.compensation = compensation;
    }

    /**
     * @return the communication
     */
    public Communication getCommunication() {
        return communication;
    }

    /**
     * @param communication the communication to set
     */
    public void setCommunication(Communication communication) {
        this.communication = communication;
    }
    
   
}
